package com.huaxonline.boot.demo;

import cn.hutool.core.thread.ThreadFactoryBuilder;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.concurrent.*;

@SpringBootApplication(scanBasePackages = "com.huaxonline")
public class DemoApplication {
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);

//        ThreadFactory namedThreadFactory = new ThreadFactoryBuilder()
//                .setNamePrefix("thread-").build();
//
//        //Common Thread Pool
//        ExecutorService pool = new ThreadPoolExecutor(2, 200,
//                0L, TimeUnit.MILLISECONDS,
//                new LinkedBlockingQueue<Runnable>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
//
//        pool.execute(()-> System.out.println(Thread.currentThread().getName()));
//        pool.execute(()-> System.out.println(Thread.currentThread().getName()));
//        pool.execute(()-> System.out.println(Thread.currentThread().getName()));
//        pool.execute(()-> System.out.println(Thread.currentThread().getName()));
//        pool.execute(()-> System.out.println(Thread.currentThread().getName()));
//        pool.execute(()-> System.out.println(Thread.currentThread().getName()));
//        pool.execute(()-> System.out.println(Thread.currentThread().getName()));
//        pool.execute(()-> System.out.println(Thread.currentThread().getName()));
//        pool.execute(()-> System.out.println(Thread.currentThread().getName()));
//
//
//        pool.shutdown();//gracefully shutdown
    }
}
